package com.huasan.www.demon.data.service.impl;
import com.huasan.www.demon.util.OnePage;
import com.huasan.www.demon.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.huasan.www.demon.data.dao.SetinfoMapper;
import com.huasan.www.demon.data.service.SetinfoService;

import com.huasan.www.demon.pojo.Setinfo;
import com.huasan.www.demon.pojo.SetinfoExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;

@Service("setinfoService")
public class SetinfoServiceImpl implements SetinfoService{
	
    @Autowired
    private SetinfoMapper setinfoDao;    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table setinfo
     *
     * @mbggenerated Mon Jan 27 17:23:02 CST 2014
     */
    public int countByExample(SetinfoExample example){
      return setinfoDao.countByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table setinfo
     *
     * @mbggenerated Mon Jan 27 17:23:02 CST 2014
     */
    public int deleteByExample(SetinfoExample example){
      return setinfoDao.deleteByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table setinfo
     *
     * @mbggenerated Mon Jan 27 17:23:02 CST 2014
     */
    public int deleteByPrimaryKey(Long id){
      return setinfoDao.deleteByPrimaryKey(id);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table setinfo
     *
     * @mbggenerated Mon Jan 27 17:23:02 CST 2014
     */
    public int insert(Setinfo record){
      return setinfoDao.insert(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table setinfo
     *
     * @mbggenerated Mon Jan 27 17:23:02 CST 2014
     */
    public int insertSelective(Setinfo record){
      return setinfoDao.insertSelective(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table setinfo
     *
     * @mbggenerated Mon Jan 27 17:23:02 CST 2014
     */
    public List<Setinfo> selectByExample(SetinfoExample example){
      return setinfoDao.selectByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table setinfo
     *
     * @mbggenerated Mon Jan 27 17:23:02 CST 2014
     */
    public Setinfo selectByPrimaryKey(Long id){
      return setinfoDao.selectByPrimaryKey(id);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table setinfo
     *
     * @mbggenerated Mon Jan 27 17:23:02 CST 2014
     */
    public int updateByExampleSelective(@Param("record") Setinfo record, @Param("example") SetinfoExample example){
      return setinfoDao.updateByExampleSelective(record,example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table setinfo
     *
     * @mbggenerated Mon Jan 27 17:23:02 CST 2014
     */
    public int updateByExample(@Param("record") Setinfo record, @Param("example") SetinfoExample example){
      return setinfoDao.updateByExample(record,example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table setinfo
     *
     * @mbggenerated Mon Jan 27 17:23:02 CST 2014
     */
    public int updateByPrimaryKeySelective(Setinfo record){
      return setinfoDao.updateByPrimaryKeySelective(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table setinfo
     *
     * @mbggenerated Mon Jan 27 17:23:02 CST 2014
     */
    public int updateByPrimaryKey(Setinfo record){
      return setinfoDao.updateByPrimaryKey(record);
    }

    public OnePage<Setinfo> selectOnePageByExample(SetinfoExample example){
    	int count = setinfoDao.countByExample(example);
    	List<Setinfo> dataList = setinfoDao.selectByExample(example);
    	OnePage<Setinfo> onepage = new OnePage<Setinfo>();
    	onepage.setPage(new Page(example.getLimitStart(), example.getLimitEnd()));
    	onepage.getPage().setCount(count);
    	onepage.setDataList(dataList);
    	return onepage;
    }
}